'''
Description: 
version: 1.0.0
Author: peng2.zhang
Date: 2021-05-10 14:10:03
LastEditors: peng2.zhang
LastEditTime: 2021-06-01 14:05:39
'''

import os
import sys
from os.path import abspath, dirname
from models.db import DBSession
from log import logger

base_path = abspath(dirname(__file__))
parent_path = os.path.join(base_path, "..")
sys.path.insert(0, parent_path)


class Handler():
    def __init__(self):
        self.db = DBSession()


class TestBase:
    handler = Handler()
    def setup(self):
        logger.info("setup method")

    def teardown(self):
        logger.info("teardown method")
        self.handler.db.close()
        logger.info("db closed")


class NoHandlerTestBase:
    def setup(self):
        logger.info("setup method")

    def teardown(self):
        logger.info("teardown method")